package com.example.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.mdao.XianLuMapper;
import com.example.model.jdao.XianLuDao;
import com.example.pojo.Xianlu;
import com.github.pagehelper.PageHelper;



@Service
@Transactional
public class XianLuService {
	@Autowired
	XianLuMapper mapper;
	
	@Autowired
	XianLuDao dao;
	
	public List<Xianlu> findall(Integer pageNum, Integer pageSize){
		PageHelper.startPage(pageNum, pageSize);
		return mapper.findall();
		
	}
	
	/*
	 * public List<Xianlu> findall(Integer pageNum,Integer pageSize){
	 * PageHelper.startPage(pageNum, pageSize); List<Xianlu> list=mapper.findAll();
	 * return list; }
	 */
	
	public void update(int is,int id) {
		dao.update(is, id);
	}
	
	
	public void updateGanTaisGidAndXlld(String xlld,List<Integer> gids) {
		dao.UPDATEGanta(xlld);
		dao.UPDATEGanta(xlld, gids);
		
	}
	
	public List<Xianlu> findxianluAll(){
		return mapper.findxianluAll();
	}
	public List<Xianlu> findxianluAll1(){
		return null;
		
	}

	/*
	 * public List<Xianlu> findxianluAll2(){ return mapper.findxianluAll2(); }
	 */
	public void deleteXL(String xlld) {
		dao.DeleteXianlu(xlld);
	}
	public Xianlu findByxlldAndXlname(String xlld,String name){
		return mapper.findByxlldAndXlname(xlld,name);
	}
	
	public List<Xianlu> findall2(String xlid,String xlname,int isqy,Integer pageNum,Integer pageSize){
		PageHelper.startPage(pageNum, pageSize);
		System.out.println(xlid+xlname+isqy);
		List<Xianlu> list=mapper.findbyid(xlid, xlname, isqy);
		System.out.println(list);
		
		return list;
	}
	
	/*
	 * public List<Xianlu> findall(){ List<Xianlu> list=mapper.findAll(); return
	 * list; }
	 */
	public void add(Xianlu xl) {
		dao.save(xl);
	}
	
}
